<template>
  <div class="chart-line-user">
    <div id="main" style="width: 80%; height: 400px;"></div>
  </div>
</template>

<script>
import echarts from 'echarts'
export default {
  data () {
    return {}
  },
  created () {
    setTimeout(() => {
      this.createChart()
    }, 100)
  },
  methods: {
    createChart () {
      let myChart = echarts.init(document.getElementById('main'))
      let options = {
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: ['会员数量', '主题量', '回复量', '浏览量']
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: false,
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            name: '会员数量',
            type: 'line',
            stack: '总量',
            data: [0, 132, 121, 134, 90, 230, 210]
          },
          {
            name: '主题量',
            type: 'line',
            stack: '总量',
            data: [220, 182, 191, 234, 290, 330, 310]
          },
          {
            name: '回复量',
            type: 'line',
            stack: '总量',
            data: [150, 232, 201, 154, 190, 330, 410]
          },
          {
            name: '浏览量',
            type: 'line',
            stack: '总量',
            data: [820, 932, 901, 934, 1290, 1330, 1320]
          }
        ]
      }
      myChart.setOption(options)
    }
  }
}
</script>

<style lang="less" scoped>
  .chart-line-user{padding: 15px}
</style>
